# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=icesprog
pkgver=0_git20240108
_commit=4796d3160825832cb1581b148b6268c844686617
pkgrel=1
pkgdesc="Programmer for iCESugar FPGA boards"
url="https://github.com/wuxx/icesugar"
arch="all"
license="LGPL-2.1-or-later"
makedepends="
	libusb-dev
	hidapi-dev
	"
subpackages="
	$pkgname-udev:_udev:noarch
	"
source="
	$pkgname-$_commit.tar.gz::https://github.com/wuxx/icesugar/archive/$_commit.tar.gz
	"
builddir="$srcdir/icesugar-$_commit"
options="!check" # no unit tests provided

build() {
	make -C tools/src
}

package() {
	install -Dm755 tools/src/icesprog "$pkgdir"/usr/bin/icesprog

	install -Dm644 tools/src/60-icesugar.rules \
		"$pkgdir"/usr/lib/udev/rules.d/60-icesugar.rules
}

_udev() {
	pkgdesc="udev rules for $pkgname"

	amove usr/lib/udev/rules.d/60-icesugar.rules
}

sha512sums="
8c0ecff47f4df58f7a1c829269ebc756c2091d86e73594a9e4465e5d021966a56f5068892dc3f8e83e7be7059c38401fa2dfc0abe0664d5d42e6b7ce3ff46c4b  icesprog-4796d3160825832cb1581b148b6268c844686617.tar.gz
"
